package ms.util;

import java.util.HashMap;
import java.util.Map;

import org.eclipse.jface.resource.ImageDescriptor;

public class ImageCache {
	private static ImageDescriptor solutionView;
	private static ImageDescriptor event;
	
	private static Map<String, ImageDescriptor> cache;
	
	public static ImageDescriptor getSolutionView() {
		if (solutionView == null)
			solutionView = SimulationUtils.getImageDescriptor("icons/solutionview.png");
		return solutionView;
	}
	
	public static ImageDescriptor getEvent() {
		if (event == null)
			event = SimulationUtils.getImageDescriptor("icons/event.png");
		return event;
	}
	
	public static ImageDescriptor getImage(String key) {
		if (cache == null)
			cache = new HashMap<String, ImageDescriptor>();
		if (!cache.containsKey(key))
			cache.put(key, SimulationUtils.getImageDescriptor(key));
		return cache.get(key);
	}
}
